package com.cs.user.controller;

import com.cs.common.result.HttpResp;
import com.cs.common.result.ResultCode;
import com.cs.domain.entity.UserInfo;
import com.cs.user.service.IUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/api/userInfo")
public class UserInfoController {

    @Autowired
    private IUserInfoService infoService;

    @GetMapping("/findAllUser")
    public HttpResp findAllUser(){
        List<UserInfo> allUser = infoService.findAllUser();
        return HttpResp.result(ResultCode.USER_QUERY_SUCCESS,new Date(),allUser);
    }

    @GetMapping("/findUserInfo")
    public HttpResp findUserInfo(String username){
        UserInfo user = infoService.findUserInfo(username);
        return HttpResp.result(ResultCode.USER_QUERY_SUCCESS,new Date(),user);
    }



}
